package com.emagic.manage.common.ui.widgets.recyclerview.itemdecoration;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.emagic.manage.R;


/**
 * Created by Lulei on 2017/8/7.
 * time : 16:44
 * date : 2017/8/7
 * mail to lulei4461@gmail.com
 */

public class SimpleDivider extends RecyclerView.ItemDecoration {

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
//        super.getItemOffsets(outRect, view, parent, state);
        final int position = parent.getChildAdapterPosition(view);
        Context context = view.getContext();
        int offeset = context.getResources().getDimensionPixelSize(R.dimen.spacing_small);

        if (position == 0) {
            outRect.left = offeset;

        }
        outRect.right = offeset;
    }
}
